---@class BuffAttributeCalculator:IAttributeCalculator
BuffAttributeCalculator = ClientFight.CreateClass("BuffAttributeCalculator",nil,ClientFight.IAttributeCalculator)

function BuffAttributeCalculator:getType()
    return CalculatorTypeEnum.BUFF
end
---获取玩家属性
---@param fight AbstractFight
---@param fighter Fighter
---@param attr BaseAttribute
---@param state BaseState
---@param sign BaseSign
function BuffAttributeCalculator:countAttribute(fight, fighter, attr, state, sign)
    --永久Buff加成
    for k,buff in pairs(fighter.permanentBuffs) do
        state.state = bit.bor(state.state,buff.state.state)
        table.addRange(sign.signs,buff.sign.signs)
        if not table.isEmpty(buff.attributes.attributes) then
            SkillRoleMgr.savePathFile(string.format("[%s][BUFF_ATT_CAL]%s计算buff %s %s 属性完成,属性值%s",
                    fight.frame, fighter.fighterId, buff.modelId,buff.id, getJsonStr(buff.attributes.attributes)));
        end
    end
    --Buff加成
    for k,buff in pairs(fighter.buffs) do
        state.state = bit.bor(state.state,buff.state.state)
        table.addRange(sign.signs,buff.sign.signs)

        if not table.isEmpty(buff.attributes.attributes) then
            SkillRoleMgr.savePathFile(string.format("[%s][BUFF_ATT_CAL]%s计算buff %s %s 属性完成,属性值%s",
                    fight.frame, fighter.fighterId, buff.modelId,buff.id, buff.attributes.attributes) );
        end
    end
    local add = not sign.signs[FighterSignEnum.TAG_1002]
    for k,buff in pairs(fighter.permanentBuffs) do
        FighterAttributeManager.add(attr,buff.attributes,add);
    end
    --Buff加成
    for k,buff in pairs(fighter.buffs) do
        FighterAttributeManager.add(attr,buff.attributes,add);
    end
end